package lojaVirtual.uteis;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class EntityManagerProvider {
	
	public static EntityManagerFactory emf = null;
	public static EntityManager em = null;	

	private EntityManagerProvider(){
		
	}
	
	public static EntityManager getEntityManagerFactory(){
		
		if( emf == null ){
			
			emf = Persistence.createEntityManagerFactory("VirtualStore");
		}
		
		if( em == null ){
			
			em = emf.createEntityManager();
		}
		return em;
	}

	
}